﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Dialect;
using NHibernate.Driver;
using NHibernate.Bytecode;

namespace InnovTech.Data.NHibernate.SQLiteUtil
{
    public class SQLiteInMemoryDBConfigurationBuilder : ConfigurationBuilderBase
    {
        protected override void OnBuilding(global::NHibernate.Cfg.Configuration config)
        {
            config.SetProperty(global::NHibernate.Cfg.Environment.ReleaseConnections, "on_close").
                   SetProperty(global::NHibernate.Cfg.Environment.Dialect, typeof(SQLiteDialect).AssemblyQualifiedName).
                   SetProperty(global::NHibernate.Cfg.Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName).
                   SetProperty(global::NHibernate.Cfg.Environment.ConnectionString, "data source=:memory:;Version=3;New=True;").
                   SetProperty(global::NHibernate.Cfg.Environment.ProxyFactoryFactoryClass, typeof(DefaultProxyFactoryFactory).AssemblyQualifiedName).
                   SetProperty(global::NHibernate.Cfg.Environment.ConnectionProvider, typeof(SQLiteInMemoryConnectionProvider).AssemblyQualifiedName).
                   SetProperty(global::NHibernate.Cfg.Environment.ShowSql, "true");
        }
    }
}
